#include "smallwidget.h"
#include "ui_smallwidget.h"

SmallWidget::SmallWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SmallWidget)
{
    ui->setupUi(this);

    //Qspinbox与Qslider的数据连接，使他们一起变化
    void(QSpinBox::  * spSignal)(int)=&QSpinBox::valueChanged;
    connect(ui->spinBox,spSignal,ui->horizontalSlider,&QSlider::setValue);
    connect(ui->horizontalSlider,&QSlider::valueChanged,ui->spinBox,&QSpinBox::setValue);


}

SmallWidget::~SmallWidget()
{
    delete ui;
}

//将控件获取的数字返回
 int SmallWidget::getNum()
 {
     return ui->spinBox->value();
 }
